#ifndef __EVENT_H
#define __EVENT_H

#include "base-structure/linux-list.h"

#define EV_READ  0x02
#define EV_WRITE 0x04

struct event_base;

struct event {
    int ev_fd;
    int ev_events;
    struct event_base *base;

    void (*cb) (int, short, void *);
    void *args;

    struct list_head active;
};

extern struct event_base *event_base_new();

extern void event_set(struct event* ev, struct event_base *base,
                      int fd, short events,
                      void (*callback)(int, short, void *), void *args);

extern void event_base_loop(struct event_base *base);

extern int event_add(struct event *ev);

#endif
